package com.foreverwin.mes.production.support;

import com.foreverwin.mes.common.enums.HandleEnum;
import com.foreverwin.mes.core.exception.BusinessException;
import com.foreverwin.mes.core.utils.CommonMethods;
import com.foreverwin.mes.core.utils.DateUtil;
import com.foreverwin.mes.core.utils.SpringUtil;
import com.foreverwin.mes.meapi.model.Inventory;
import com.foreverwin.mes.meapi.service.InventoryService;
import com.foreverwin.mes.production.dto.ResourceInventoryDto;
import com.foreverwin.mes.production.model.ResourceInventory;
import com.foreverwin.mes.production.model.ResourceInventoryLog;
import com.foreverwin.mes.production.service.ResourceInventoryLogService;
import com.foreverwin.mes.production.service.ResourceInventoryService;

import java.util.Date;

/**
 * @author Ervin Chen
 * @date 2020/2/5 12:03
 */
public class InventoryIdUnloadStrategy implements UnloadStrategy {

    private InventoryService inventoryService;
    private ResourceInventoryService resourceInventoryService;
    private ResourceInventoryLogService resourceInventoryLogService;

    @Override
    public void initService() {
        inventoryService = SpringUtil.getBean(InventoryService.class);
        resourceInventoryService = SpringUtil.getBean(ResourceInventoryService.class);
        resourceInventoryLogService = SpringUtil.getBean(ResourceInventoryLogService.class);
    }

    @Override
    public boolean validate(ResourceInventoryDto resourceInventoryDto) {
        String itemBo = resourceInventoryDto.getItemBo();
        String loadMode = resourceInventoryDto.getLoadMode();

        throw BusinessException.build( "production.resourceInventory.unloadNotSupport", HandleEnum.ITEM.getPart( itemBo, 1 ), loadMode );
    }

    @Override
    public boolean unload(ResourceInventoryDto resourceInventoryDto) {
        return true;
    }
}
